<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

<%-- <%@taglib uri="spring.tld" prefix="spring"%> --%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html>
	<head>
    	<base href="<%=basePath%>">
    
    	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<title>用户管理</title>
		<meta name="keywords" content="">
		<link rel="shortcut icon" href="<%=basePath%>resources/images/favicon.ico" />
		<link href="resources/bootstrap/css/bootstrap-huan.css" rel="stylesheet">
		<link href="resources/font-awesome/css/font-awesome.min.css" rel="stylesheet">
		<link href="resources/css/style.css" rel="stylesheet">
		
		<link href="resources/css/exam.css" rel="stylesheet">
		<link href="resources/chart/morris.css" rel="stylesheet">
		
		<style type="text/css">
			.disable-btn, .enable-btn{
				text-decoration: underline;
			}
			.disable-btn, .enable-btn{
				cursor:pointer;
			}
		</style>
	</head>
	
	<body>
		<header>
			<div class="container">
				<div class="row">
					<div class="col-xs-5">
						<div class="logo">
							<h1><a href="#">网站管理系统</a></h1>
							<div class="hmeta">
								专注互联网在线考试解决方案
							</div>
						</div>
					</div>
					<div class="col-xs-7" id="login-info">
						<c:choose>
							<c:when test="${not empty sessionScope.SPRING_SECURITY_CONTEXT.authentication.principal.username}">
								<div id="login-info-user">
									
									<a href="user-detail/${sessionScope.SPRING_SECURITY_CONTEXT.authentication.principal.username}" id="system-info-account" target="_blank">${sessionScope.SPRING_SECURITY_CONTEXT.authentication.principal.username}</a>
									<span>|</span>
									<a href="j_spring_security_logout"><i class="fa fa-sign-out"></i> 退出</a>
								</div>
							</c:when>
							<c:otherwise>
								<a class="btn btn-primary" href="user-register">用户注册</a>
								<a class="btn btn-success" href="user-login-page">登录</a>
							</c:otherwise>
						</c:choose>
					</div>
				</div>
			</div>
		</header>
		<!-- Navigation bar starts -->

		<div class="navbar bs-docs-nav" role="banner">
			<div class="container">
				<nav class="collapse navbar-collapse bs-navbar-collapse" role="navigation">
					<ul class="nav navbar-nav">
						<li>
							<a href="#"><i class="fa fa-home"></i>网站首页</a>
						</li>
						<li>
							<a href="admin/question-list"><i class="fa fa-edit"></i>试题管理</a>
						</li>

						<li>
							<a href="admin/exampaper-list"><i class="fa fa-file-text-o"></i>试卷管理</a>
						</li>
						<li class="active">
							<a href="admin/user-list"><i class="fa fa-user"></i>用户管理</a>
						</li>
						<li>
							<a href="admin/field-list-1"><i class="fa fa-cloud"></i>题库管理</a>
						</li>
						<li>
							<a href="admin/sys-backup"><i class="fa fa-cogs"></i>网站设置</a>
						</li>
					</ul>
				</nav>
			</div>
		</div>

		<!-- Navigation bar ends -->

		<!-- Slider starts -->

		<div>
			<!-- Slider (Flex Slider) -->

			<div class="container" style="min-height:500px;">

				<div class="row">
					<div class="col-xs-3">
						<ul class="nav default-sidenav">
							<li>
								<a href="admin/user-list"> <i class="fa fa-list-ul"></i> 用户管理 </a>
							</li>
							<li>
								<a href="admin/add-user"> <i class="fa fa-list-ul"></i> 添加用户 </a>
							</li>
							<li class="active">
								<a> <i class="fa fa-list-ul"></i> 用户练习统计 </a>
							</li>
						</ul>
					</div>
					<div class="col-xs-9">
						<div class="page-header">
							<h1><i class="fa fa-list-ul"></i> 用户练习统计 </h1>
						</div>
						<div class="page-header">
									<div style="display:inline-block;">
   							 		<div style="display:inline-block;">开始日期：</div><div class="inline laydate-icon" id="start" style="width:120px;display:inline-block;margin-right:10px;"/>${startTime }</div>
   							 		<div style="display:inline-block;">结束日期：</div><div class="inline laydate-icon" id="end" style="width:120px;display:inline-block;margin-right:15px;"/>${endTime }</div>
   							 		<div style="display:inline-block;">姓名：<input type="text" class="df-input-narrow" id="name" value="${userName }"></div>
   							 		<div style="display:inline-block;"><input type="button" id="serach_button" value="查询"/></div>
									</div>
							</div>
						<div class="page-content row">
						
							<div id="question-list">
								<table class="table-striped table">
									<thead>
										<tr>
											<td>用户名</td>
											<td>部门</td>
											<td>账号</td>
											<td>做题总数</td>
											<td>正确题数</td>
											<td>错误题数</td>
										</tr>
									</thead>
									<tbody>
										<c:forEach items="${recordList }" var="item">
											<tr>
												<td>${item.trueName}</td>
												<td>${item.department}</td>
												<td>${item.userName}</td>
												<td>${item.totalNum}</td>
												<td>${item.successNum}</td>
												<td>${item.errorNum}</td>
												<!-- <td></td> -->
											</tr>
										</c:forEach>
										
									</tbody><tfoot></tfoot>
								</table>
							</div>
							<div id="page-link-content">
								<ul class="pagination pagination-sm">${pageStr}</ul>
							</div>

						</div>
					</div>
				</div>
			</div>
		</div>

		<footer>
			<div class="container">
				<div class="row">
					<div class="col-md-12">
						<div class="copy">
							<p>
								贵州邮电规划设计院 Copyright © <a href="http://www.gzcdc.com/" target="_blank">贵州邮电规划设计院</a> - <a href="." target="_blank">主页</a> | <a href="http://www.gzcdc.com/" target="_blank">关于我们</a> | <a href="http://www.gzcdc.com/" target="_blank">FAQ</a> | <a href="http://www.gzcdc.com/" target="_blank">联系我们</a>
							</p>
						</div>
					</div>
				</div>

			</div>

		</footer>

		<!-- Slider Ends -->

		<!-- Javascript files -->
		<!-- jQuery -->
		<script type="text/javascript" src="resources/js/jquery/jquery-1.9.0.min.js"></script>
		<script type="text/javascript" src="resources/js/all.js"></script>
		<script type="text/javascript" src="resources/js/laydate/laydate.js"></script>
		<!-- Bootstrap JS -->
		<script type="text/javascript" src="resources/bootstrap/js/bootstrap.min.js"></script>
	<script>
				laydate.skin('danlan');//切换皮肤，请查看skins下面皮肤库
				var start = {
    				elem: '#start',
    				format: 'YYYY-MM-DD',
    				min:'2000-01-11', //设定最小日期为当前日期
    				max: '2099-06-16', //最大日期
    				istime: true,
    				istoday: false,
   					choose: function(datas){
         				end.min = datas; //开始日选好后，重置结束日的最小日期
         				end.start = datas //将结束日的初始值设定为开始日
    				}
				};
				var end = {
    				elem: '#end',
    				format: 'YYYY-MM-DD',
    				min: '2000-01-11',
    				max: '2099-06-16',
    				istime: true,
    				istoday: false,
    				choose: function(datas){
        				start.max = datas; //结束日选好后，充值开始日的最大日期
   					 }
				};
				laydate(start);
				laydate(end);
				
				$(function(){
				$("#serach_button").click(function(){	
					if($("#start").text() == "" ||  $("#end").text() == ""){
						alert("开始日期和结束日期不能为空!");
						return;
					}
					var urlStr =  document
										.getElementsByTagName('base')[0].href
										+ "admin/user-practice-record/"+$("#start").text() + "/" +
										$("#end").text() +"/" +"1" ;
				   if($("#name").val()	!= ""){
				   		urlStr = urlStr + "?userName="+ encodeURI($("#name").val());
				   }	
					document.location.href = urlStr;
					
				});
				
				$(".pagination li a").click(function(){
					var pageId = $(this).data("id");
					if(pageId==null||pageId=="")return false;
					var urlStr =  document
										.getElementsByTagName('base')[0].href
										+ "admin/user-practice-record/"+$("#start").text() + "/" +
										$("#end").text() +"/" + pageId;
				   if($("#name").val()	!= ""){
				   		urlStr = urlStr + "?userName="+ encodeURI($("#name").val());
				   }	
					document.location.href = urlStr;
				});
				
				
				});
		</script>
</body>
</html>